<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
	<link href="css/mycss.css" rel="stylesheet"/>
	<link href="css/iconfont.css" rel="stylesheet"/>
    <script type="text/javascript" charset="utf-8">
      	
		mui.plusReady(function (){
			plus.navigator.closeSplashscreen();
			localStorage.setItem('request_url','https://m.161006.online/');
			var a = localStorage.getItem('day');
			if(a==null){
				var time = new Date();
				var now = time.getFullYear() + '.' + time.getMonth() + '.' +  time.getDate()
				localStorage.setItem('day', now)
			}else{
				var time = new Date();
				var now = time.getFullYear() + '.' + time.getMonth() + '.' +  time.getDate()
				if(a!=now){
					localStorage.setItem('tel_code', 0)
				}
			}
			// localStorage.setItem('request_url','http://127.0.0.1:8001/');
			
			// 检查是否有更新延时启动
			setTimeout(function(){
				mui.getJSON("manifest.json", null, function(manifest){
				    var versionName = manifest.version.name;
				    var versionCode = Number(manifest.version.code);
					mui.ajax(localStorage.getItem('request_url')+'cost/check_code/',{
					    data:"token=1",
					    dataType: 'json',
					    type:'post',  
					    contentType:"application/x-www-form-urlencoded; charset=utf-8",  
					    timeout:60000,  
					    success:function show(e){
							var new_versonName = e.data.versionName
							var new_versonCode = e.data.versionCode
							if(new_versonName != versionName | new_versonCode != versionCode){
								var btnArray = ['以后再说', '立即前去'];
								mui.confirm('最新版本号:'+ new_versonName +'      是否前往更新?', '发现新版本', btnArray, function(e) {
									if(e.index == 1) {
										mui.openWindow({
											url : 'update_page.html',
											id : 'update_page.html'
										});
									}
								});
							}
						}
					});
				});
			},3000)
			
			
			
		    // 定义子页面数组
			var subPages = ['home.html', 'new_info.html','mine_page.html'];
			// 定义子页面显示的样式
			var subPageStyle={
				top:"44px",
				bottom:"50px"
			};
			// 获取主webview
			var mainView = plus.webview.currentWebview();
			// 遍历子页面数组，根据数组url创建webview
			for(var i=0; i<subPages.length; i++){
				var url = subPages[i];
				var subView = plus.webview.create(url,url,subPageStyle);
				// 默认每个子url处理隐藏状态
				subView.hide();
				// 为了主子webview同时显示，将每个子加入到主中
				mainView.append(subView);
			}
			// 默认显示主页
			plus.webview.show(subPages[0]);
			// 给每个url注册事件
			mui(".mui-bar-tab").on("tap", "a", function(){
				// 设置当前当行对应的子页面显示;就是根据指定的id设置webview显示
				var id = this.getAttribute('href')
				plus.webview.show(id);
			});
		})
    </script>
	
</head>
<body>
	<header class="mui-bar mui-bar-nav .mui-bar-transparent">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<h1 class="mui-title">丝雨</h1>
	</header>
	<nav class="mui-bar mui-bar-tab">
		<a class="mui-tab-item mui-active" href="home.html">
			<span class="mui-icon iconfont icon-zhuye"></span>
			<span class="mui-tab-label">首页</span>
		</a>
		<a class="mui-tab-item" href="new_info.html">
			<span class="mui-icon iconfont icon-xinzeng-"></span>
			<span class="mui-tab-label">记一笔</span>
		</a>
		<a class="mui-tab-item" href="mine_page.html">
			<span class="mui-icon iconfont icon-wode"></span>
			<span class="mui-tab-label">我的</span>
		</a>
	</nav>
</body>
</html>